using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace Sedodream.Sudoku.Board
{
	[DebuggerDisplay("{ToString()}")]
	public class Point : IPoint
	{
		#region Fields
		private int row;
		private int col;
		#endregion

		#region Constructors
		public Point()
		{
			Row = 0;
			Col = 0;
		}
		public Point(int row,int col)
			: this()
		{
			Row = row;
			Col = col;
		}
		#endregion

		#region IPoint implementation
		public int Col
		{
			get { return col; }
			set { col = value; }
		}
		public int Row
		{
			get { return row; }
			set { row = value; }
		}
		#endregion
		public override string ToString()
		{
			return string.Format("(Row={0},Col={1})",Row,Col);
		}
		public override bool Equals(object obj)
		{
			if (obj == null)
				return false;
			IPoint other = obj as IPoint;
			if (other == null)
				return false;
			if (other.Row == this.Row &&
				other.Col == this.Col)
				return true;
			return false;
		}
		public override int GetHashCode()
		{
			return (int)(Math.Abs((double)(Row + Col) + 3) * Math.Ceiling((double)Math.Abs(Row) + 1) * Math.Ceiling((double)Math.Abs(Col) + 1));
		}
	}
}
